package com.sky.controller.admin;

import com.sky.result.Result;

import com.sky.service.VueCountryService;
import com.sky.service.VueRegionService;
import com.sky.service.VueVisaTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/admin/template")
@Slf4j
@Api(tags = "模板相关接口")
@CrossOrigin
public class VueAddProductController {

    @Autowired
    private VueCountryService vueCountryService;

    @Autowired
    private VueVisaTypeService vueVisaTypeService;

    @Autowired
    private VueRegionService vueRegionService;

    @GetMapping("/countries")
    @ApiOperation("获取国家列表")
    public Result<List<Map<String, Object>>> getCountries() {
        log.info("获取国家列表");
        List<Map<String, Object>> countries = vueCountryService.getAllCountryNames();
        return Result.success(countries);
    }

    @GetMapping("/visa-types")
    @ApiOperation("获取签证类型列表")
    public Result<List<Map<String, Object>>> getVisaTypes() {
        log.info("获取签证类型列表");
        List<Map<String, Object>> visaTypes = vueVisaTypeService.getAllVisaTypeNames();
        return Result.success(visaTypes);
    }

    @GetMapping("/regions")
    @ApiOperation("获取领区列表")
    public Result<List<Map<String, Object>>> getRegions() {
        log.info("获取领区列表");
        List<Map<String, Object>> regions = vueRegionService.getAllRegionNames();
        return Result.success(regions);
    }
}